<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <input type="text" name="studentId" id="studentId">
    <input type="text" name="studentName" id="studentName">
    <input type="submit" value="提交" id="submit">
</body>
<script src="./js/jquery-3.6.3.min.js"></script>
<script>
    // 通过DOMAPI获取元素
    // let submitEl = document.querySelector("#submit");
    // 通过jQuery获取元素
    $("#submit").click(function() {
        // 获取studentId
        let studentId = $("#studentId").val();
        // 获取学生姓名 
        let studentName = $("#studentName").val();
        // 构造成一个JS对象
        let postDate = {
            "studentId" : studentId,
            "studentName" : studentName
        };

        // 发送AJAX 请求
        $.ajax ({
            // 方法
            type: "post", 
            url: "jackson  ",
            contentType : "application/json",
            data : JSON.stringify(postDate),
            success : function (data) {
                console.log(data);
            }
        }); 
    });
</script>
</html>